import JSEncrypt from 'jsencrypt'

const publicKey = 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCJJNb2xRsegw/in6Ta0mIMSRQ8iNL/PPO2Z9qhJxtAuzGw9MrkCU1WHjUOZdEKE/ClOnTkhc0mLvVqxfyqYAk2BA7PScOYgGgW5xo4ZhHE7PMk9yAYG9fwm9krY4UuqhjhZPTvqzcBEPA1WT6Fl79++OCElNAzqyZQKr6v8S1kawIDAQAB'

export const encrypt = async (txt: string): Promise<string> => {
  const encryptor = new JSEncrypt()
  encryptor.setPublicKey(publicKey)
  const encryptedTxt = await encryptor.encrypt(txt)
  return encryptedTxt
}
